package com.sunyzc.ebaotech.simulator.ybt;

import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;

public interface IYBTProcessor {
	public String getServerHost();

	public void setServerHost(String serverHost);

	public YBTClientConfig getClientConfig();

	public void setClientConfig(YBTClientConfig clientConfig);

	/** 设置服务器时间相对于本地时间的日期偏移量 */
	public void setDateOffSet(int dateOffset);

	/** 日期格式统一为yyyyMMdd，然后再转换成各个银行报文中的日期格式 */
	public void setCurrentDate(String currentDateStr) throws ParseException;

	/** 根据形如RP1002-PolicyNo的transXmlMapKey从历史报文中获取相应节点的值 */
	public String getElementValue(String transXmlMapKey);

	/** 根据形如RP1002-PolicyNo的transXmlMapKey从历史报文中获取相应节点的值，如果没有找到节点则返回defaultValue默认值 */
	public String getElementValue(String transXmlMapKey, String defaultValue);

	public byte[] generateHeadBytes(String requestTransType, byte[] requestBodyContent) throws Exception;

	/** 根据requestTransType获取请求报文模板 */
	public String generateRequestBodyTemplateStr(String requestTransType, boolean needRemoveComments) throws Exception;

	/** 根据请求报文模板，静态替换流水号、交易日期、交易时间等字段，然后正则替换保单号、保费等字段 */
	public String generateRequestBodyStr(String requestTransType, String requestBodyTemplateStr, boolean needRemoveComments) throws Exception;

	/** 根据请求报文模板，静态替换流水号、交易日期、交易时间等字段，然后正则替换保单号、保费等字段 */
	public byte[] generateRequestBodyBytes(String requestTransType, String requestBodyTemplateStr, boolean needRemoveComments) throws Exception;

	public byte[] generateResponseBodyBytes(String requestTransType) throws Exception;

	public byte[] convertContentStrToBytes(String contentStr) throws Exception;

	public String convertContentBytesToStr(byte[] contentBytes) throws Exception;

	public String readHeadConetentStr(String requestTransType, InputStream inputStream) throws IOException;

	public String readBodyConetentStr(String requestTransType, InputStream inputStream, String headContentStr) throws Exception;
}
